insheet using waraimsclean.csv

* Calculate instruments for energy consumption per capita (cappig1), iron-steel
* consumption per capita (cappig2), and democracy - autocracy (WSDemRes)

regress capitalistpig1 year s w logpop
predict cappig1, residuals
regress capitalistpig2 year w s logpop
predict cappig2, residuals
gen democracy = (10 + democ - autoc)/20
regress democracy w s
predict WSDemRes, residuals

* Mindless renaming of variables to make Stata happy

ren s S
ren w W
ren w_mod W_mod
ren opps oppS
ren oppw oppW
ren oppw_mod oppW_mod
ren effectives effectiveS
ren effectiveopps effectiveoppS
ren effectives_mod effectiveS_mod
ren effectiveopps_mod effectiveoppS_mod

* The next four lines produces the results reported in Table 9.1

logit territory W effectiveS oppW powerratio landcontig if hostlev >= 4
logit territory W effectiveS oppW powerratio logpop year post45 landcontig WSDemRes cappig1 cappig2 if hostlev >= 4
logit territory W effectiveS oppW powerratio landcontig if hostlev >= 4 & joinerdyad == 0
logit territory W effectiveS oppW powerratio logpop year post45 landcontig WSDemRes cappig1 cappig2 if hostlev >= 4 & joinerdyad == 0

* The next four lines shows the results using the typical definition of 
* contiguity 

logit territory W effectiveS oppW powerratio normalcontig if hostlev >= 4
logit territory W effectiveS oppW powerratio logpop year post45 normalcontig WSDemRes cappig1 cappig2 if hostlev >= 4
logit territory W effectiveS oppW powerratio normalcontig if hostlev >= 4 & joinerdyad == 0
logit territory W effectiveS oppW powerratio logpop year post45 normalcontig WSDemRes cappig1 cappig2 if hostlev >= 4 & joinerdyad == 0

clear
exit
